package com.supermarket.manage.common.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.supermarket.manage.common.validation.CheckGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 会员实体类
 *
 * @author: Faxon
 * @data: 2020/3/12
 */
@ApiModel(value = "Member:会员实体类")
@Data
@TableName("tb_member")
public class Member implements Serializable {

    private static final long serialVersionUID = 5502929115023124195L;
    /**
     * 会员id
     */
    @ApiModelProperty(value = "会员id")
    @TableId(type = IdType.ASSIGN_UUID)
    @NotBlank(message = "会员id不能为空", groups = {CheckGroup.Update.class})
    private String mid;

    /**
     * 会员手机号
     */
    @ApiModelProperty(value = "会员手机号")
    @NotBlank(message = "会员手机号不能为空", groups = {CheckGroup.Add.class})
    private String mphone;

    /**
     * 添加人id
     */
    @ApiModelProperty(value = "添加人id")
    @NotNull(message = "添加人id不能为空", groups = {CheckGroup.Add.class})
    private Long createdMan;

    /**
     * 会员积分
     */
    @ApiModelProperty(value = "会员积分")
    @NotBlank(message = "会员积分不能为空", groups = {CheckGroup.Update.class})
    private BigDecimal integral;

    /**
     * 会员状态（0：正常，1：已删除）
     */
    @ApiModelProperty(value = "会员状态（0：正常，1：已删除）")
    private Integer status;

    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @NotBlank(message = "客户id不能为空", groups = {CheckGroup.Add.class})
    private String buyerId;

    /**
     * 添加时间
     */
    @ApiModelProperty(value = "添加时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date created;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updated;

    /**
     * 添加人名称
     */
    @ApiModelProperty(value = "添加人名称")
    @TableField(exist = false)
    private String createdManName;
}

